package com.spider.common.web.controller;

import com.spider.common.bean.Category;
import com.spider.common.utils.R;
import com.spider.common.web.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author marver
 * @Description 分类
 * @date 2018/12/17 15:40
 */
@Controller
@RequestMapping("/category")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;

    /**
     * 获取分类列表
     * @param category
     * @return
     */
    @RequestMapping("/get")
    @ResponseBody
    public R getCategoryList(Category category){
        List<Category> categories = categoryService.queryCategoryList(category);
        return R.ok().put("categories",categories);
    }
}
